package com.huaxin.hxmodulestatisticalanalysis.models;

import com.baomidou.mybatisplus.annotation.*;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;

import java.time.LocalDateTime;

@Data
public class BaseModel {
    /**
     * 唯一ID（UUID）- 主键
     */
    @TableId(value = "id", type = IdType.ASSIGN_UUID)
    private String id;

    /**
     * 自增序列号（唯一索引，非主键）
     */
    @TableField(value = "auto_id")
    private Long autoId;

    /**
     * 创建时间
     */
    @TableField(value = "created_at", fill = FieldFill.INSERT)
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    private LocalDateTime createdAt;

    /**
     * 创建人
     */
    @TableField(value = "created_by", fill = FieldFill.INSERT)
    private String createdBy;

    /**
     * 更新时间
     */
    @TableField(value = "updated_at", fill = FieldFill.INSERT_UPDATE)
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    private LocalDateTime updatedAt;

    /**
     * 更新人
     */
    @TableField(value = "updated_by", fill = FieldFill.INSERT_UPDATE)
    private String updatedBy;

    /**
     * 是否删除（0:未删, 1:已删）
     */
    @TableLogic
    @TableField(value = "is_deleted")
    private Integer isDeleted = 0;

    /**
     * 删除时间
     */
    @TableField(value = "deleted_at", fill = FieldFill.UPDATE)
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    private LocalDateTime deletedAt;

    /**
     * 删除人
     */
    @TableField(value = "deleted_by", fill = FieldFill.UPDATE)
    private String deletedBy;

    /**
     * 组织ID
     */
    @TableField(value = "org_id")
    private String orgId;
    /**
     * 家庭ID
     */
    @TableField(value = "family_id")
    private String familyId;
}
